<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
</head>
<body>

    <h1>首页</h1>

    <!-- 以后我们会越来越倾向于用一句话来作为请求的URL地址，在这样的一句话中使用“/”分隔各个单词 -->
    <!-- say hello to spring mvc -->
    <!-- /say/hello/to/spring/mvc -->
    <a th:href="@{/say/hello/to/springmvc}">HelloWorld</a><br/>

    <h3>测试@RequestMapping注解匹配方式</h3>
    <a th:href="@{fruit/apple}">@RequestMapping模糊匹配[apple]</a><br>
    <a th:href="@{fruit/orange}">@RequestMapping模糊匹配[orange]</a><br>
    <a th:href="@{fruit/banana}">@RequestMapping模糊匹配[banana]</a><br>

    <h3>测试@RequestMapping注解标记在类上</h3>
    <a th:href="@{/user/login}">用户登录</a><br>
    <a th:href="@{/user/register}">用户注册</a><br>
    <a th:href="@{/user/logout}">用户退出</a><br>

    <h3>测试@RequestMapping注解限定请求方式</h3>
    <a th:href="@{/emp}">同地址GET请求</a><br>
    <form th:action="@{/emp}" method="post">
        <button type="submit">同地址POST请求</button>
    </form>

    <h3>测试发送和获取请求参数</h3>
    <a th:href="@{/param/one/name/one/value(username='tom')}">一个名字一个值得情况</a><br>

    一个名字多个值 <br>
    <form th:action="@{/param/one/name/multi/value}" method="post">
        请选择你最喜欢的球队：
        <input type="checkbox" name="team" value="Brazil"/>巴西
        <input type="checkbox" name="team" value="German"/>德国
        <input type="checkbox" name="team" value="French"/>法国
        <input type="checkbox" name="team" value="Holland"/>荷兰
        <input type="checkbox" name="team" value="Italian"/>意大利
        <input type="checkbox" name="team" value="China"/>中国
        <input type="checkbox" name="team" value="China"/>中国
        <input type="checkbox" name="team" value="China"/>中国
        <br/>
        <input type="submit" value="保存"/>
    </form>

    表单对应实体类 <br>
    <form th:action="@{param/form/to/entity}" method="post">
        姓名：<input type="text" name="empName"/><br/>
        年龄：<input type="text" name="empAge"/><br/>
        工资：<input type="text" name="empSalary"/><br/>
        <input type="submit" value="保存"/>
    </form>

    表单对应的实体类包含级联属性 <br>
    <form th:action="@{param/form/to/nested/entity}" method="post">
        stuName:<input type="text" name="stuName">
        school.schoolName:<input type="text" name="school.schoolName">
        subjectList[0].subjectName:<input type="text" name="subjectList[0].subjectName" value="java"/><br/>
        subjectList[1].subjectName:<input type="text" name="subjectList[1].subjectName" value="php"/><br/>
        subjectList[2].subjectName:<input type="text" name="subjectList[2].subjectName" value="javascript"/>
        <br>
        subjectList[3].subjectName:<input type="text" name="subjectList[3].subjectName" value="css"/><br/>
        subjectList[4].subjectName:<input type="text" name="subjectList[4].subjectName" value="vue"/><br/>
        subjectArray[0].subjectName:<input type="text" name="subjectArray[0].subjectName" value="spring"/><br/>
        <br>
        subjectArray[1].subjectName:<input type="text" name="subjectArray[1].subjectName" value="SpringMVC"/><br/>
        subjectArray[2].subjectName:<input type="text" name="subjectArray[2].subjectName" value="mybatis"/><br/>
        subjectArray[3].subjectName:<input type="text" name="subjectArray[3].subjectName" value="maven"/><br/>
        subjectArray[4].subjectName:<input type="text" name="subjectArray[4].subjectName" value="mysql"/><br/>
        tearcherSet[0].teacherName:<input type="text" name="teacherSet[0].teacherName" value="t_one"/><br/>
        tearcherSet[1].teacherName:<input type="text" name="teacherSet[1].teacherName" value="t_two"/><br/>
        tearcherSet[2].teacherName:<input type="text" name="teacherSet[2].teacherName" value="t_three"/><br/>
        tearcherSet[3].teacherName:<input type="text" name="teacherSet[3].teacherName" value="t_four"/><br/>
        tearcherSet[4].teacherName:<input type="text" name="teacherSet[4].teacherName" value="t_five"/><br/>
        scores['Chinese']：input type="text" name="scores['Chinese']" value="100"/><br/>
        scores['English']：<input type="text" name="scores['English']" value="95"/><br/>
        scores['Mathematics']：<input type="text" name="scores['Mathematics']" value="88"/><br/>
        scores['Chemistry']：<input type="text" name="scores['Chemistry']" value="63"/><br/>
        scores['Biology']：<input type="text" name="scores['Biology']" value="44"/><br/>
        <input type="submit" value="保存"/>
    </form>

    <h3>获取请求消息头</h3>
    <a th:href="@{/request/header}">获取请求消息头</a>

    <h3>获取请求头携带的cookie信息</h3>
    <a th:href="@{/request/cookie}">获取请求头携带的cookie信息</a>

    <h3>测试页面跳转</h3>
    <a th:href="@{test/forward/command}">测试转发指令</a>
    <a th:href="@{test/redirect/command}">测试重定向指令</a>

</body>
</html>